package com.koron.css2.newProjectCenter.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.newProjectCenter.bean.PjInfoBean;
import com.koron.css2.newProjectCenter.bean.query.PjInfoQueryBean;
import com.koron.css2.newProjectCenter.mapper.PjInfoMapper;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

/**
 * @Author: 苏小龙
 * @CreateTime: 2024-12-12
 * @Description: 根据工程编号查询
 * @Version: 1.0
 */
public class PjInfoBillNO implements ServerInterface {
    @Override
    public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
        try {
        PjInfoMapper mapper = factory.getMapper(PjInfoMapper.class);
        PjInfoQueryBean queryBean = JsonUtils.objectToPojo(req.getData(), PjInfoQueryBean.class);
        PjInfoBean bean=mapper.selectEndByBillNo(queryBean.getBillNo());
        MessageBean<PjInfoBean> info = MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "查询成功", PjInfoBean.class);
        info.setData(bean);
            return info;
        } catch (Exception e) {
            factory.close(false);
            logger.error("根据工程编号" + e.getMessage(), e);
            e.printStackTrace();
            return MessageBean.create(Constant.MESSAGE_INT_FAIL, "查询失败", null);
        }
    }
}
